import React, { Component } from 'react'
import { connect } from 'react-redux'
import {BrowserRouter} from 'react-router-dom'
import RouterView from './router/RouterView'
import routerList from './router/routerConfig'
import Axios from 'axios'
export class App extends Component {
  render() {
    return (
     <BrowserRouter>
        <RouterView routerList={routerList}></RouterView>
     </BrowserRouter>
    )
  }
  componentDidMount(){
    this.props.getList()
  }
}

const mapStateToProps = (state) => {
  return{
    
  }
}

const mapDispatchToProps =(dispatch)=> {
  return{
    getList(){
      dispatch(()=>{
        Axios.get('/getList').then(res=>{
          dispatch({type:'GET_LIST',data:res.data.data})
        })
      })
    }
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(App)
